turtule code for digital clock

50

from turtle import *
import turtle

scr = turtle.Screen()
 
scr.setup(500, 500)

clock = turtle.Turtle()
 
clock.color('cyan')
 
clock.width(5)
 
 
def drawhourhand():
    clock.penup()
    clock.home()
    clock.right(90)
    clock.pendown()
    clock.forward(100)
 

val = 0
 
for i in range(12):
   
    val += 1
 
    clock.penup()
 
     clock.setheading(-30 * (i + 3) + 75)
 
    clock.forward(22)

    clock.pendown()
 
    clock.forward(15)
 
    clock.penup()
 
    clock.forward(20)
 
    clock.write(str(val), align="center",
              font=("Arial",
                    12, "normal"))
clock.setpos(2, -112)
clock.pendown()
clock.width(2)

clock.fillcolor('Green')
 
clock.begin_fill()
 
clock.circle(7)
 
clock.end_fill()
 
clock.penup()
drawhourhand()
clock.setpos(-18, -62)
clock.pendown()
clock.penup()
 
clock.setpos(-28, -150)
clock.pendown()
clock.write('Python Guides', font=("Arial",14,
                              "normal"))
clock.hideturtle()
turtle.done()

Comments

Submit
0 Comments